package thread;

/**
 * @author DBX
 * @effect 常见面试题
 * @date 2021/8/31 0031 - 21:30
 */
public class ThreadTest {
    public static void main(String[] args) {
        Thread t = new MyThread();
        t.start();
        try {
            t.sleep(5*1000);//main线程睡眠5秒
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.out.println("--------------------------------");
    }
}
class MyThread extends Thread{
    @Override
    public void run() {
        for (int i = 0; i < 1000; i++) {
            System.out.println(getName()+"---->"+i);
        }
    }
}